{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}
{% import "demand/partial/search_demand_client_form.html" as search_demand_client_form_macro %}
{% import "demand/partial/demand_client_table.html" as demand_client_table_macro %}

{% block title %}万屏时代OPC--客户列表{% endblock %}

{% block panel_heading %}
    <style>
        .fa-venus {
            color: #F08E83;
        }
        .fa-mars {
            color: #A0D9F6;
        }
    </style>
  万屏时代OPC--客户列表
  <div class="pull-right btn-group">
    <a href="{{ url_for('op_bp.add_user') }}" class="btn btn-sm btn-success" target="_blank">
        新建用户
    </a>
  </div>
{% endblock %}

{% block panel_body %}
    {{ search_demand_client_form_macro.gen_form(form, current_user) }}

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'op_bp.demand_clients', **url_kwargs) }}
    </div>
    {% endif %}

    {{ demand_client_table_macro.gen_table(clients) }}

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'op_bp.demand_clients', **url_kwargs) }}
    </div>
    {% endif %}
{% endblock %}

{% block scripts %}
    {{ super() }}
    <script>
        $(document).ready(function () {
            $("#export-demand-clients").click(function () {
                var url = '{{ url_for('op_bp.export_demand_clients') }}';
                url = url + '?' + 
                    'user_mobile=' + $('#user_mobile').val() +
                    '&user_nickname=' + $('#user_nickname').val() +
                    '&sem_path=' + $('#sem_path').val() +
                    '&operate_time_filter=' + $('#operate_time_filter').val() +
                    '&client_source=' + $('#client_source').val() +
                    '&operate_result=' + $('#operate_result').val() +
                    '&sem_plan=' + $('#sem_plan').val() +
                    '&sem_unit=' + $('#sem_unit').val() +
                    '&sem_keyword=' + $('#sem_keyword').val() +
                    '&last_visit_time_begin=' + $('#last_visit_time_begin').val() +
                    '&last_visit_time_end=' + $('#last_visit_time_end').val();
                window.location.href = url;
            });
        })
    </script>
{% endblock %}
